table.insert(itemActions,
	function(item, action)
		-- RARE gloves rev1.1 by Kel. Last update 7.18.08
		-- see: dir .. "readme.txt" for information regarding these variables
		local priority = 6
		local identify = true
		local dump = true

		if not (item.quality == ItemQuality.Rare and item.baseItem.baseType.Type == ItemKind.Gloves) then 
			return false
		elseif action == aPICK and (not item.flags.Identified or isGoodRareGloves(item)) then
			return priority
		elseif action == aIDENT then
			return identify
		elseif action == aSELL and item.flags.Identified and not isGoodRareGloves(item) then
			return true
		elseif action == aDUMP and item.flags.Identified and not isGoodRareGloves(item) then
			return dump
		end

		return false
	end
)

function isGoodRareGloves(item)
	local ias, str, dex, sktab, mf = false, false, false, false, false
    local ures, dres, tres = false, false, false


	 ures = hasRes(item, 26, 1) --1 Single resist of 26-30%
	 dres = hasRes(item, 21, 2) --2 Single resists of 21-30%
     tres = hasRes(item, 11, 3)  --3 Single resists of 11-30%

	if hasRes(item, 11, 4) then -- keep ALL w/11-30% to 4 res (rare)
		return true
	end

	for i = 0, item.mods:size() - 1 do
		if (item.mods[i].Stat.Type == StatType.FasterAttackRate and item.mods[i].Value >= 10) then
			ias = true
		elseif (item.mods[i].Stat.Type == StatType.Strength and item.mods[i].Value >= 10) then
			str = true
		elseif (item.mods[i].Stat.Type == StatType.Dexterity and item.mods[i].Value >= 10) then
			dex = true
			
-- No idea why this was here. Class skills don't appear on gloves.
-- Will be removed in release version.
--		elseif item.mods[i].Stat.Type == StatType.ClassSkillsBonus and
--				item.mods[i].Value >= 2 then -- 2sk
--			sk = true

		elseif  item.mods[i].Stat.Type == StatType.SkillTabBonus and
				item.mods[i].Value >= 2 then --  2sktab
			sktab = true
		elseif  item.mods[i].Stat.Type == StatType.MagicFind and
				item.mods[i].Value >= 25 then --  25MF
			mf = true

		end
	end

	return (
		   ias and sktab or
		   (ias and (str or dex)) or
		   (ias and (ures or dres or tres)) or
		   ((str or dex) and (dres or tres)) or
	 	   (mf and (ias or (str and dex) or ures or dres or tres))
	 	   )
end

--[[
Rare Gloves:  Good Prefixes
================================================
Affix     	 Level  LvReq  Freq   Stats
================================================
Holy			36	27		6	 81-100% Defense
Godly			50	43		1	 101-200% Defense
Faithful		30	22		3	 4 Defense per Level
Dragon's		52	39		2	 31-40 to Mana
Lapis			12	9		4	 Cold Resist +11-20%
Cobalt			18	13		3	 Cold Resist +21-30%
Russet			12	9		4	 Fire Resist +11-20%
Garnet			18	13		3	 Fire Resist +21-30%
Ocher			12	9		4	 Lite Resist +11-20%
Coral			18	13		3	 Lite Resist +21-30%
Viridian		12	9		4	 Psn  Resist +11-20%
Jade			18	13		3	 Psn  Resist +21-30%
Sensei's		40	30		1	 +2 Martial Arts (Assassin)
Spearmaiden's	40	30		1	 +2 Javelin & Spear Skills (Amazon)
Gymnastic		40	30		1	 +2 Passive & Magic Skills (Amazon)
Bowyer's		40	30		1	 +2 Bow & Crossbow Skills (Amazon)

Rare Gloves:  Good Suffixes
================================================
Affix     	 Level  LvReq  Freq   Stats
================================================
of Readiness	20	15		2	10% Increased Attack Speed
of Alacrity		43	35		4	20% Increased Attack Speed
of Precision	56	48		3	10-15 Dexterity
of the Giant	59	51		3	10-15 to Strength
of Wealth		17	12		4	41-80% Goldfind
of Fortune		16	12		4	16-25% Magic Find
of the Leech	34	26		4	3% Life Leech
of the Bat		35	27		4	3% Mana Leech
of Self-Repair	3	1		3	Repair 1 Dur in 33 Sec
of Restoration	20	12		2	Repair 1 Dur in 20 Sec
	]]--